package cn.xiaobai.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * todo 修改
 * @author jiangfei
 * @date 2019/11/16
 */
public enum ToolConfigTypeEnum {

    INPUT(0, "输入配置项"),
    FILE(1, "EXCEL文件配置项"),
    MAPPING(2, "映射关系配置项"),
    LIST(3, "List类型配置项"),
    SELECT(4, "下拉框类型配置项"),
    NUMBER(5, "数字框");

    /**
     * id
     */
    private Integer id;

    /**
     * 名称
     */
    private String name;

    ToolConfigTypeEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    @JsonCreator
    public static ToolConfigTypeEnum getItem(Integer id) {
        for (ToolConfigTypeEnum item : values()) {
            if (item.getId().equals(id)) {
                return item;
            }
        }
        return null;
    }

    @JsonValue
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
